package com.lemon.system.controller;

import com.lemon.core.web.Result;
import com.lemon.mybatisplus.base.BaseController;
import com.lemon.system.dto.UserDTO;
import com.lemon.system.po.UserPO;
import com.lemon.system.service.IUserService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

/**
 * 用户表控制层
 *
 * @author 李猛
 * @since 2024-02-11
 */
@Log4j2
@RestController
@RequestMapping("user")
public class UserController extends BaseController<UserPO, UserDTO, IUserService> {
    @Resource
    private IUserService iUserService;

    /**
     * 根据用户名查询用户信息
     *
     * @param username
     * @return
     */
    @PermitAll
    @GetMapping("getByUsername")
    public Result<Void> getByUsername(@RequestParam String username) {
        return iUserService.getByUsername(username);
    }
}